import json

class MysqlDatabases:
    def __init__(self):
        self.users= json.loads(open('user.json',mode='r',encoding='utf-8').read())
        self.students = json.loads(open('students.json', mode='r', encoding='utf-8').read())



    def check_login(self,username,password):
        for user in self.users:
            if username==user['username']:
                if password== user['password']:
                    return True,'登陆成功'
                else:
                    return False,'登陆失败,密码错误'
    def all(self):
        return self.students

db=MysqlDatabases()
if __name__ == '__main__':
    print(db.check_login('admin','123456'))
    print(db.all())